<?php

use EasySwoole\Log\LoggerInterface;

return [
    'SERVER_NAME' => "BaiyouEasySwoole",
    'MAIN_SERVER' => [
        'LISTEN_ADDRESS' => '0.0.0.0',
        'PORT' => 10086,
        'SERVER_TYPE' => EASYSWOOLE_WEB_SOCKET_SERVER, //可选为 EASYSWOOLE_SERVER  EASYSWOOLE_WEB_SERVER EASYSWOOLE_WEB_SOCKET_SERVER
        'SOCK_TYPE' => SWOOLE_TCP,
        'RUN_MODEL' => SWOOLE_PROCESS,
        'SETTING' => [
            'worker_num' => 4,
            'reload_async' => true,
            'max_wait_time' => 3,
            'heartbeat_check_interval' => 30,// 服务器定时检测在线列表的时间
            'heartbeat_idle_time' => 60,//  连接最大的空闲时间 （如果最后一个心跳包的时间与当前时间之差超过这个值，则认为该连接失效）
            'package_max_length'    => 50 *1024 *1024,
        ],
        'TASK' => [
            'workerNum' => 8,
            'maxRunningNum' => 128,
            'timeout' => 15
        ]
    ],
    // websocket子服务
    'WEBSOCKET_SERVER' => [
        'LISTEN_ADDRESS' => '0.0.0.0',
        'PORT' => 10088,
        'SOCK_TYPE' => SWOOLE_TCP,
        'SETTING' => [],
    ],
    // rpc服务
    'RPC_SERVER' => [
        'SERVER_IP' => '127.0.0.1',
        'LISTEN_ADDRESS' => '0.0.0.0',
        'PORT' => 10087,
        'SETTING' => [
            'worker_num' => 4,
            'package_max_length' => 2 *1024 *1024,
            'network_read_timeout' => 3,
        ],
    ],
    "LOG" => [
        // 设置记录日志文件时日志文件存放目录
        'dir' => null,
        // 设置记录日志时的日志最低等级，低于此等级的日志不进行记录和显示
        'level' => LoggerInterface::LOG_LEVEL_DEBUG,
        // 设置日志处理器 `handler` (handler)
        'handler' =>  new \App\Log\LogHandler(),
        // 设置记录日志到日志文件时是否在控制台打印日志
        'logConsole' => true,
        // 设置是否开启在控制台打印日志
        'displayConsole' => true,
        // 设置打印日志时忽略哪些分类的日志不进行记录
        'ignoreCategory' => [],
    ],
//    'TEMP_DIR' => __DIR__.'/tmp',
    'TEMP_DIR' => '/tmp/easyswoole/hcrm',
    /*################ MYSQL CONFIG ##################*/
    'MYSQL' => [
        'host'                  => '39.98.61.102',
        'port'                  => '3306',
        'database'              => 'baiyou_pre',
        'user'                  => 'his_test',
        'password'              => 'his123456',
        'timeout'               => '120',
        'charset'               => 'utf8mb4',
        'tablePrefix'           => 'by_',
        // 连接池配置
        'autoPing'              => 5,
        'getObjectTimeout'      => 3,// 设置获取连接池对象超时时间
        'intervalCheckTime'     => 30*1000,// 设置检测连接存活执行回收和创建的周期
        'maxIdleTime'           => 15,// 连接池对象最大闲置时间(秒)
        'maxObjectNum'          => 20,// 设置最大连接池存在连接对象数量
        'minObjectNum'          => 5,// 设置最小连接池存在连接对象数量
    ],
    /*################ REDIS CONFIG ##################*/
    'REDIS' => [
        'host'      => '127.0.0.1',
        'port'      => '6379',
        'auth'      => '',
        'db'        => 5,
        'serialize' => \EasySwoole\Redis\Config\RedisConfig::SERIALIZE_NONE
    ],
    /*################ TOKEN CONFIG ##################*/
    // token有效期 默认 24 小时
    'USER' => [
        'accessTokenExpire' => 24 * 60 * 60 * 30,
    ],
    'BAIDU_TTS' => [
        'apiKey' => 'KoG0dqLkmfj5sL5r0nXDtUGa',
        'secretKey' => '8DSCzqQZuq0Eb9BGafpuo5lyA6IvSeAT',
        'filePath' => __DIR__.'/tmp',
    ],
    'URL' => [
        'ws' => 'http://baiyou-ws-test.jgyljt.com'
    ],
];
